package com.test;

import java.util.ArrayList;
import java.util.concurrent.TimeUnit;

/**
 * Created by 41579 on 2017/5/31.
 */
public class UnsafeVariableRunnable implements Runnable {
    private ArrayList<String> unsafeVariableList = new ArrayList<String>();

    public ArrayList<String> getUnsafeVariableList() {
        return unsafeVariableList;
    }

    public void setUnsafeVariableList(ArrayList<String> unsafeVariableList) {
        this.unsafeVariableList = unsafeVariableList;
    }

    @Override
    public void run() {
        try {
            TimeUnit.SECONDS.sleep(3);
            unsafeVariableList.add(Thread.currentThread().getName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
